#pragma once

#include "Input.h"

namespace mmath
{
	class Ray;
}

namespace mphys
{
	class PhysicsSystem;
}

namespace mgfx
{
	class RenderingSystem;
}

namespace mscene
{
	class Camera;
	class Node;
	class SceneSaver;

	class Scene
	{
	public:
		Scene(mgfx::RenderingSystem & renderSys, mphys::PhysicsSystem & physSys);
		~Scene();

		void addNode(Node & node);
		void deleteNode(Node & node);
		Camera & getCamera() { assert(mCamera); return *mCamera; }

		void update(float dt);

		Node* getIntersectingNode(const mmath::Ray & ray);

		void mouseMove(int moveX, int moveY);
		bool keyEvent(util::KeyEvent event, WPARAM wParam, LPARAM lParam);

		void commitEditorChanges();

		friend class SceneSaver;

		mphys::PhysicsSystem & PhysSys;
		mgfx::RenderingSystem & RenderSys;

	protected:
		Camera * mCamera;
		std::vector<Node*> mNodes;
	};
}